package com.moonshine.spdemo.controller;

import com.moonshine.spdemo.domain.ReturnMessage;
import com.moonshine.spdemo.domain.UserInfo;
import com.moonshine.spdemo.service.GetUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
public class HelloController {

    @Autowired
    GetUserService getUserService;

    @RequestMapping("/hello")
    @ResponseBody
    public ReturnMessage<String> getHello(){

        return new ReturnMessage("请求成功", 1000, "123");
    }

    @RequestMapping(value = "/getUserInfo")
    @ResponseBody
    public ReturnMessage<UserInfo> sayHello(int id){
        return new ReturnMessage("请求成功", 1000, getUserService.getUserInfo(id));
    }
}
